#ifndef __BSP_BLE_H__
#define __BSP_BLE_H__


#include "config.h"
//#include <stdint.h>
#include "hc32_ddl.h"



/** @defgroup BLE_CTRL definition
 * @{
 */
#define BSP_BLE_CTRL_PORT    (PortC)     /* INPUT */
#define BSP_BLE_CTRL_PIN     (Pin12)


#define BleCtrlOn()       (PORT_ResetBits(BSP_BLE_CTRL_PORT, BSP_BLE_CTRL_PIN))
#define BleCtrlOff()      (PORT_SetBits(BSP_BLE_CTRL_PORT, BSP_BLE_CTRL_PIN))
/**
 * @}
 */


/** @defgroup BLE_UART definition
 * @{
 */
/* USART channel definition */
#define BSP_BLE_USART_CH                         (M4_USART4)
#define BSP_BLE_USART_CLK                        (PWC_FCG1_PERIPH_USART4)

/* USART baudrate definition */
#define BSP_BLE_USART_BAUDRATE                   (115200ul)

/* USART RX Port/Pin definition */
#define BSP_BLE_USART_RX_PORT                    (PortB)  
#define BSP_BLE_USART_RX_PIN                     (Pin03)          
#define BSP_BLE_USART_RX_FUNC                    (Func_Usart4_Rx)

/* USART TX Port/Pin definition */
#define BSP_BLE_USART_TX_PORT                    (PortB)  
#define BSP_BLE_USART_TX_PIN                     (Pin04)          
#define BSP_BLE_USART_TX_FUNC                    (Func_Usart4_Tx)

/* USART interrupt number  */
#define BSP_BLE_USART_EI_NUM                     (INT_USART4_EI)
#define BSP_BLE_USART_RI_NUM                     (INT_USART4_RI)
#define BSP_BLE_USART_TI_NUM                     (INT_USART4_TI)
#define BSP_BLE_USART_TCI_NUM                    (INT_USART4_TCI)
/**
 * @}
 */

void BspBleInit(void);
void BspBleUartSet(void);
void InitSpiFlash(void);
void BspBleUartInit(void);
void BspBleUartDeInit(void);


#endif
